package com.dsh.order.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dsh.admin.entity.ShopUser;
import com.dsh.admin.manager.ShopUserMng;
import com.dsh.code.entity.Page;
import com.dsh.order.entity.OrderManage;
import com.dsh.order.manager.OrderManageMng;
import com.github.pagehelper.PageInfo;

@Controller
@RequestMapping("/order")
public class OrderManageAct {
	@RequestMapping("/list.do")
	public String getList(OrderManage bean,HttpServletRequest request,Page varpage,Model model){
		ShopUser user = (ShopUser)request.getSession().getAttribute("user");
		bean.setShop_id(user.getShop_id());
		PageInfo<OrderManage> page = orderManageMng.getList(bean,varpage.getPageNum(),varpage.getPageSize());
		model.addAttribute("page", page);
		return "bms/order/list";
	}
	/**
	 * 加载新建订单页面
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping("/toAddPage.do")
	public String toAddPage(HttpServletRequest request,Model model){
		
		return "bms/order/add";
	}
	
	/**
	 * 保存新建订单信息
	 * @param bean
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping("/saveAdd.do")
	@ResponseBody
	public String saveAdd(OrderManage bean,HttpServletRequest request,Model model){
		
		return "1";
	}
	
	
	
	
	@Resource(name="shopUserMngImpl")
	private ShopUserMng shopUserMng;//管理员信息
	
	@Resource(name="orderManageMngImpl")
	private OrderManageMng orderManageMng;

}
